//
//  QQView.h
//  TestTableView
//
//  Created by Hunk on 12-1-9.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>

@protocol QQViewDelegate;
@protocol QQViewDataSource;

@interface QQView : UIView <UITableViewDelegate, UITableViewDataSource>
{
    @private
    UITableView         *_tableView;
    
    // Key:SectionKey_0, SectionKey_1 ...
    NSMutableDictionary *_sectionDictionary;
    
    id<QQViewDataSource> _dataSource;
    
    id<QQViewDelegate>   _delegate;
}
@property (nonatomic, assign)   id<QQViewDataSource> dataSource;
@property (nonatomic, assign)   id<QQViewDelegate>   delegate;

// If fold, return YES, else return NO
- (BOOL)headerViewFoldInSection:(NSInteger)section;

@end

@protocol QQViewDataSource <NSObject>

@required
- (NSInteger)numberOfSectionsInQQView:(QQView *)qqView;

- (NSInteger)qqView:(QQView *)qqView numberOfRowsInSection:(NSInteger)section flag:(BOOL)flag;

- (UIView *)qqView:(QQView *)qqView viewForHeaderInSection:(NSInteger)section;

- (UITableViewCell *)qqView:(QQView *)qqView
                  tableView:(UITableView *)tableView 
      cellForRowAtIndexPath:(NSIndexPath *)indexPath;

@end

@protocol QQViewDelegate <NSObject>

@required
- (CGFloat)qqView:(QQView *)qqView heightForRowAtIndexPath:(NSIndexPath *)indexPath;

- (CGFloat)qqView:(QQView *)qqView heightForHeaderInSection:(NSInteger)section;

@end